package com.fd.dx.service.impl;

import com.fd.dx.mapper.ZPMapper;
import com.fd.dx.service.StatService;
import com.fd.dx.web.domain.GeneCell;
import com.fd.dx.web.domain.PieCell;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by lenovo on 2018/2/27.
 */
@Service
public class StatServiceImpl implements StatService{
    @Autowired
    private ZPMapper zpMapper;
    @Override
    public List<GeneCell> getGene() {
        List result=new ArrayList();
        List<Integer> ds=zpMapper.daList();
        for(Integer i :ds)
        {
            Integer count=zpMapper.getDaiCountfromGene(i);
            result.add(new GeneCell(i,"第"+i+"代",count+""));
        }
        return result;
    }

    @Override
    public List<PieCell> getPieCell() {
        List result=new ArrayList();
        List<Integer> ds=zpMapper.daList();
        for(Integer i :ds)
        {
            Integer count=zpMapper.getDaiCountfromGene(i);
            result.add(new PieCell("第"+i+"代",count+""));
        }
        return result;
    }
}
